{include file="common/top"}
{include file="common/left"}
<section class="rt_wrap content mCustomScrollbar">
<div class="rt_content">
	<section>
      <h2><strong style="color:grey;">管理员列表</strong></h2>
      <div class="page_title">
      <a href="{:url('adminuser/addAdminUser')}" class="fr top_rt_btn">添加管理员</a>
      <a href="{:url('adminuser/listAdminUser')}" class="fr top_rt_btn">管理员列表</a>
	  </div>
		<table class="table">
      	<tr>
        <th>管理员昵称</th>
        <th>管理员真实姓名</th>
        <th>账号状态</th>
       </tr>
       <?php foreach($adminUserInfo as $v){?>
       <tr>
        <td><?= $v['account']?></td>
        <td><?= $v['realName']?></td>
        <td><input type="button" userId="<?= $v['userId']?>" value="<?= $v['status']?>" class="group_btn"/></td>
       </tr>
       <?php }?>
      </table>
    </section>
</div>

<script>
	$(document).on('click','.group_btn',function()
	{
		var userId = $(this).attr('userId');

		var status = $(this).val();

		obj = $(this);
		
		$.ajax({
			url:"{:url('adminuser/updateAdminUserStatus')}",
			type:"post",
			data:{userId:userId,status:status},
			dataType:"json",
			success:function(result)
			{
				if (result.error == 0)
				{
					obj.val('已冻结');
				}
				else
				{
					obj.val('正常');
				}
			}
		})
	})
</script>